/**
 */
package autoSAR.impl;

import autoSAR.AutoSARPackage;
import autoSAR.ClientServicePPort;
import autoSAR.ClientServiceRPort;
import autoSAR.IB;
import autoSAR.PostRecivePPort;
import autoSAR.PostReciveRPort;
import autoSAR.SWC;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>SWC</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link autoSAR.impl.SWCImpl#getIb <em>Ib</em>}</li>
 *   <li>{@link autoSAR.impl.SWCImpl#getName <em>Name</em>}</li>
 *   <li>{@link autoSAR.impl.SWCImpl#getClientservicerport <em>Clientservicerport</em>}</li>
 *   <li>{@link autoSAR.impl.SWCImpl#getClientservicepport <em>Clientservicepport</em>}</li>
 *   <li>{@link autoSAR.impl.SWCImpl#getPostreciverport <em>Postreciverport</em>}</li>
 *   <li>{@link autoSAR.impl.SWCImpl#getPostrecivepport <em>Postrecivepport</em>}</li>
 * </ul>
 *
 * @generated
 */
public abstract class SWCImpl extends MinimalEObjectImpl.Container implements SWC {
	/**
	 * The cached value of the '{@link #getIb() <em>Ib</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIb()
	 * @generated
	 * @ordered
	 */
	protected EList<IB> ib;

	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The cached value of the '{@link #getClientservicerport() <em>Clientservicerport</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getClientservicerport()
	 * @generated
	 * @ordered
	 */
	protected EList<ClientServiceRPort> clientservicerport;

	/**
	 * The cached value of the '{@link #getClientservicepport() <em>Clientservicepport</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getClientservicepport()
	 * @generated
	 * @ordered
	 */
	protected EList<ClientServicePPort> clientservicepport;

	/**
	 * The cached value of the '{@link #getPostreciverport() <em>Postreciverport</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPostreciverport()
	 * @generated
	 * @ordered
	 */
	protected EList<PostReciveRPort> postreciverport;

	/**
	 * The cached value of the '{@link #getPostrecivepport() <em>Postrecivepport</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPostrecivepport()
	 * @generated
	 * @ordered
	 */
	protected EList<PostRecivePPort> postrecivepport;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SWCImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return AutoSARPackage.Literals.SWC;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<IB> getIb() {
		if (ib == null) {
			ib = new EObjectContainmentEList<IB>(IB.class, this, AutoSARPackage.SWC__IB);
		}
		return ib;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, AutoSARPackage.SWC__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ClientServiceRPort> getClientservicerport() {
		if (clientservicerport == null) {
			clientservicerport = new EObjectContainmentEList<ClientServiceRPort>(ClientServiceRPort.class, this,
					AutoSARPackage.SWC__CLIENTSERVICERPORT);
		}
		return clientservicerport;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ClientServicePPort> getClientservicepport() {
		if (clientservicepport == null) {
			clientservicepport = new EObjectContainmentEList<ClientServicePPort>(ClientServicePPort.class, this,
					AutoSARPackage.SWC__CLIENTSERVICEPPORT);
		}
		return clientservicepport;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<PostReciveRPort> getPostreciverport() {
		if (postreciverport == null) {
			postreciverport = new EObjectContainmentEList<PostReciveRPort>(PostReciveRPort.class, this,
					AutoSARPackage.SWC__POSTRECIVERPORT);
		}
		return postreciverport;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<PostRecivePPort> getPostrecivepport() {
		if (postrecivepport == null) {
			postrecivepport = new EObjectContainmentEList<PostRecivePPort>(PostRecivePPort.class, this,
					AutoSARPackage.SWC__POSTRECIVEPPORT);
		}
		return postrecivepport;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
		case AutoSARPackage.SWC__IB:
			return ((InternalEList<?>) getIb()).basicRemove(otherEnd, msgs);
		case AutoSARPackage.SWC__CLIENTSERVICERPORT:
			return ((InternalEList<?>) getClientservicerport()).basicRemove(otherEnd, msgs);
		case AutoSARPackage.SWC__CLIENTSERVICEPPORT:
			return ((InternalEList<?>) getClientservicepport()).basicRemove(otherEnd, msgs);
		case AutoSARPackage.SWC__POSTRECIVERPORT:
			return ((InternalEList<?>) getPostreciverport()).basicRemove(otherEnd, msgs);
		case AutoSARPackage.SWC__POSTRECIVEPPORT:
			return ((InternalEList<?>) getPostrecivepport()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case AutoSARPackage.SWC__IB:
			return getIb();
		case AutoSARPackage.SWC__NAME:
			return getName();
		case AutoSARPackage.SWC__CLIENTSERVICERPORT:
			return getClientservicerport();
		case AutoSARPackage.SWC__CLIENTSERVICEPPORT:
			return getClientservicepport();
		case AutoSARPackage.SWC__POSTRECIVERPORT:
			return getPostreciverport();
		case AutoSARPackage.SWC__POSTRECIVEPPORT:
			return getPostrecivepport();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case AutoSARPackage.SWC__IB:
			getIb().clear();
			getIb().addAll((Collection<? extends IB>) newValue);
			return;
		case AutoSARPackage.SWC__NAME:
			setName((String) newValue);
			return;
		case AutoSARPackage.SWC__CLIENTSERVICERPORT:
			getClientservicerport().clear();
			getClientservicerport().addAll((Collection<? extends ClientServiceRPort>) newValue);
			return;
		case AutoSARPackage.SWC__CLIENTSERVICEPPORT:
			getClientservicepport().clear();
			getClientservicepport().addAll((Collection<? extends ClientServicePPort>) newValue);
			return;
		case AutoSARPackage.SWC__POSTRECIVERPORT:
			getPostreciverport().clear();
			getPostreciverport().addAll((Collection<? extends PostReciveRPort>) newValue);
			return;
		case AutoSARPackage.SWC__POSTRECIVEPPORT:
			getPostrecivepport().clear();
			getPostrecivepport().addAll((Collection<? extends PostRecivePPort>) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case AutoSARPackage.SWC__IB:
			getIb().clear();
			return;
		case AutoSARPackage.SWC__NAME:
			setName(NAME_EDEFAULT);
			return;
		case AutoSARPackage.SWC__CLIENTSERVICERPORT:
			getClientservicerport().clear();
			return;
		case AutoSARPackage.SWC__CLIENTSERVICEPPORT:
			getClientservicepport().clear();
			return;
		case AutoSARPackage.SWC__POSTRECIVERPORT:
			getPostreciverport().clear();
			return;
		case AutoSARPackage.SWC__POSTRECIVEPPORT:
			getPostrecivepport().clear();
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case AutoSARPackage.SWC__IB:
			return ib != null && !ib.isEmpty();
		case AutoSARPackage.SWC__NAME:
			return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
		case AutoSARPackage.SWC__CLIENTSERVICERPORT:
			return clientservicerport != null && !clientservicerport.isEmpty();
		case AutoSARPackage.SWC__CLIENTSERVICEPPORT:
			return clientservicepport != null && !clientservicepport.isEmpty();
		case AutoSARPackage.SWC__POSTRECIVERPORT:
			return postreciverport != null && !postreciverport.isEmpty();
		case AutoSARPackage.SWC__POSTRECIVEPPORT:
			return postrecivepport != null && !postrecivepport.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy())
			return super.toString();

		StringBuilder result = new StringBuilder(super.toString());
		result.append(" (name: ");
		result.append(name);
		result.append(')');
		return result.toString();
	}

} //SWCImpl
